<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <input type="text" name="password" />
  <br />
  <span id="msg"></span>
  
</body>
<script>
  
  document.querySelector("[name='password']").addEventListener("keyup",function(){
    let length=this.value.length;
    let span=document.querySelector("#msg");
    let msg="";
    if(length>10){
      msg="密码无敌";
    }else if(length>5){
      msg="中级密码强度";
    }else if(length==0){
      msg="";
    }else{
      msg="密码弱";
    }
    span.innerHTML=msg;
    
  });

</script>
</html>